package com.nbsaas.boot.project.rest.convert;

import com.nbsaas.boot.project.data.entity.DataModel;
import com.nbsaas.boot.project.api.domain.request.DataModelRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.boot.project.data.entity.Project;

/**
* 请求对象转换成实体对象
*/

public class DataModelEntityConvert  implements Converter<DataModel, DataModelRequest> {

    @Override
    public DataModel convert(DataModelRequest source) {
        DataModel result = new DataModel();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getProject()!=null){
                    Project project =new Project();
                    project.setId(source.getProject());
                    result.setProject(project);
                    }
        return result;
    }
}

